package com.hp.controller;

import com.hp.pojo.Seehouseapplication;
import com.hp.service.SeeHouseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
public class SeeHouseController {
    @Autowired
    SeeHouseService seeHouseService;

    @PostMapping("/getAllSeeHouseInfos")
    Map<String,Object> getAllSeeHouseInfos(){

        return seeHouseService.getAllHouseInfos();
    }

    @ResponseBody
    @PostMapping("/AddSeeHouseApplication")
    public Map<String,Object> AddSeeHouseApplication(Seehouseapplication seehouseapplication){
        return seeHouseService.AddSeeHouseApplication(seehouseapplication);
    }


    @PostMapping("/AcceptSeeHouse")
    public Map<String, Object>  AcceptSeeHouse (int seehouseapplicationId){
        return seeHouseService.AcceptSeeHouse(seehouseapplicationId);
    }

    @PostMapping("/QuitSeeHouse")
    public Map<String, Object> QuitSeeHouse (int seehouseapplicationId){
        return seeHouseService.QuitSeeHouse(seehouseapplicationId);
    }

    @PostMapping("/CompleteSeeHouse")
    public Map<String, Object> CompleteSeeHouse(int seehouseapplicationId){
        return seeHouseService.CompleteSeeHouse(seehouseapplicationId);
    }

    @PostMapping("/getSeeHouseByagentid")
    public Map<String,Object> getSeeHouseByagentid(int agentId){

        return seeHouseService.getSeeHouseByagentid(agentId);

    }

    @PostMapping("/getSeeHouseByuserid")
    public Map<String,Object> getSeeHouseByuserid(int seehouseapplicationApplyerid){
        return seeHouseService.getSeehouseByuserId(seehouseapplicationApplyerid);
    }

    @PostMapping("/getSeehouseByid")
    public Map<String, Object> getSeeHouseByid(int seehouseapplicationId){
        return seeHouseService.getSeehouseByid(seehouseapplicationId);
    }

    @PostMapping("/checkApplication")
    public Map<String, Object> checkApplication(int seehouseapplicationId, int seehouseapplicationState){
        return seeHouseService.checkApplication(seehouseapplicationId, seehouseapplicationState);
    }
}
